<style scoped src="./index.scss" lang="scss" rel="stylesheet/scss"></style>
<template src="./index.html"></template>
<script>
export default {
    mixins: [Vue.prototype.$vFN.Mixins.Base, Vue.prototype.$vFN.Mixins.Edit],
    components: {
        SelectDataUsers: async () =>
            Vue.extend(await Vue.prototype.$vFN.Components.Base.SelectDataUsers()),
    },
    data() {
        return {
            appWindow: window,
            form: {
                level_id: null,
            },

            editVisible: true,
            // 会员id+
            usersIds: [],

            // 等级列表
            levelList: [],
        };
    },
    methods: {
        async sum() {
            let res = await this.$vFN.Http.post({
                url: "plugin/team-dividend/admin/member/addDealer",
                data: {
                    level_id: this.form.level_id,
                    member_id: this.usersIds[0]
                }
            }, window);
            if(res.code == 200) {
                this.editVisible = false;
                this.onSuccess();
                this.$vFN.Tools.messageSuccess("操作成功");
            }
        },
        // 获取等级列表
        async getLevel() {
            let res = await this.$vFN.Http.post({
                url: "plugin/team-dividend/admin/level/list",
            }, window);
            console.log(res.data.list);
            this.levelList = res.data.list;
        },
        // 初始化
        async init() {
            this.getLevel()
            // 初始化数据
            // await this.mixinEdit_editBoxInit({
            //     model: "form",
            //     id: this.id,
            // });
        },
        onSuccess() {},
        cacel() {
            this.editVisible = false;
        }

    },
    mounted() {
        this.init();
    },
    activated() {},
};
</script>